package com.mall.b2c.bean;

import java.math.BigDecimal;

import com.mall.b2c.domain.intergral.ShopProductDomain;
import org.apache.commons.lang3.StringUtils;

import com.mall.b2c.domain.order.OrderItemDomain;
import com.mall.common.util.DateHelper;

public class GoodsBuyRecordBean {
	private String buyDate;
	private String productName;
	private String userName;
	private BigDecimal salePrice;
	private Integer quantity;

	public GoodsBuyRecordBean(OrderItemDomain orderItem) {
		this.buyDate = DateHelper.date2String(orderItem.getOrder().getCreateDate(), "yyyy-MM-dd HH:mm:ss");
		this.productName = orderItem.getProductName();
		this.userName = orderItem.getOrder().getMember().getUsername();
		if(StringUtils.isNotBlank(this.userName)) {
			this.userName = this.userName.charAt(0) + "***" + this.userName.charAt(this.userName.length() - 1);
		}
		this.salePrice = orderItem.getSalePrice();
		this.quantity = orderItem.getQuantity();
	}

	public String getBuyDate() {
		return buyDate;
	}

	public void setBuyDate(String buyDate) {
		this.buyDate = buyDate;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public BigDecimal getSalePrice() {
		return salePrice;
	}

	public void setSalePrice(BigDecimal salePrice) {
		this.salePrice = salePrice;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}


}
